|
![](/i/fill.gif) |
Here's an adaptation that measures the length of the spline first:
camera { location <0,2,-2> look_at 0 }
light_source { <-5,30,-10> 1 }
#declare MySpline =
spline {
cubic_spline
-.25, <0,0,-1>
0.00, <1,0,0>
0.25, <0,0,1>
0.50, <-1,0,0>
0.75, <0,0,-1>
1.00, <1,0,0>
1.25, <0,0,1>
}
#declare Percentage = 43;
#local ctr = 0;
#local SplineLength = 0;
#local OldPoint = MySpline(0);
#while (ctr <= 1)
#local SplineLength = SplineLength + vlength(MySpline(ctr)-OldPoint);
#local OldPoint = MySpline(ctr);
#local ctr = ctr + 0.0001;
#end
#local ctr = 0;
#local DistanceTraveled = 0;
#local OldPoint = MySpline(0);
#while (DistanceTraveled < Percentage*SplineLength/100)
#local DistanceTraveled = DistanceTraveled +
vlength(MySpline(ctr)-OldPoint);
#local OldPoint = MySpline(ctr);
sphere {
MySpline(ctr),.1
pigment { rgb <1-ctr,ctr,0> }
}
#local ctr = ctr + 0.001;
#end
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |